Private
Const ENGINE_VER:String = "Rainbow-Console v 0.1 alpha"

Type TConsoleVar
	Field fTyp:String
	
	Field fInt:Int
	Field fFloat:Float
	Field fString:String
	Field fCustom:Object
	Field fFunction:String(args:String[])
End Type

Public

Type TConsole
	Field fRegisters:TMap
	
	Method RegisterObject:Byte(name:String, obj:Object, typ:String = "int")	'Default-int
		If (Not name Or Not obj) Then
			Return False
		End
		If (MapContains(fRegisters, name))
			Output("Double registering of function "..name)
			Return False
		End
		Local lConsoleVar:tConsoleVar = New tConsoleVar()
		Select Lower(typ)
			Case "int"
				lConsoleVar.fTyp 		= "int"
				lConsoleVar.fInt 		= Int(obj.ToString())
			Case "float"
				lConsoleVar.fTyp 		= "float"
				lConsoleVar.fFloat	= Float(obj.ToString())
			Case "string"
				lConsoleVar.fTyp		= "string"
				lConsoleVar.fString	= obj.ToString()
			Default
				lConsoleVar.fTyp		= "custom"
				lConsoleVar.fCustom	= obj
		End Select
		MapInsert(fRegisters, name, lConsoleVar)
		Return True
	End Method
	
	Method RegisterFunction:Byte(name, func:String(args:String[])
		If (Not name Or Not func)
			Return False
		End
		If (MapContains(fRegisters:TMap, name))
			Output("Double registering of function "..name)
			Return False
		End
		Local lConsoleVar:TConsoleVar = New tConsoleVar
		lConsoleVar.fTyp = "function"
		lConsoleVar.fFunction = func
		MapInsert(fRegisters, name, lConsoleVar)
		Return True
	End Method
	
End Type
	
